package mainScreen;

import java.awt.event.ActionEvent;

import javax.swing.JLabel;
import javax.swing.JPanel;

import sidebar.Sidebar;
import ui.ImageButton;

public class Town implements MainScreen
{
	JPanel screenPanel;
	Sidebar sidebar;

	public Town()
	{
		screenPanel = new JPanel();
		screenPanel.setLayout(null);
	}
	
	public void initiate(Sidebar sidebar)
	{
		// TODO: Initialize Town
		this.sidebar = sidebar;
		JLabel label = new JLabel("Town");
		label.setBounds(200, 200, 800, 100);
		screenPanel.add(label);
		ImageButton.spawnButton ("button", "Recruit Specialists", "Recruit", this, screenPanel, 260, 260, sidebar.getOptions());
		ImageButton.spawnButton ("button", "Visit the Market", "Shopt", this, screenPanel, 260, 360, sidebar.getOptions());
		repaint();
	}

	@Override
	public void actionPerformed(ActionEvent event)
	{
		switch(event.getActionCommand())
		{
		case "Recruit":
			System.out.println("Opening recruitement.");
			break;
		default:
			System.err.println("Command " + event.getActionCommand() + " in 'Town' not implemented.");	
		}
		
	}

	public JPanel getPanel()
	{
		return screenPanel;
	}

	public String getScreenType()
	{
		return "Town";
	}

	public void repaint()
	{
		screenPanel.repaint();
		
	}

	public void endTurn()
	{
		//Town end of turn - restock
		
	}
}